;----------------------------------------------------------------------------
; File name:	STRUCT.SH			Revision date:	1997.08.08
; Authors:	Ronald Andersson		Creation date:	1997.03.26
;(c)1997 by:	Ulf Ronald Andersson		All rights reserved
;Released as:	FREEWARE			(commercial sale forbidden)
;----------------------------------------------------------------------------
; Purpose:	Header file included in assembly sources
;----------------------------------------------------------------------------
;Required header declarations:
;
;	include	"uran\STRUCT.SH"
;
;----------------------------------------------------------------------------
;	Macro definitions for data structure definitions
;
struct_index	=	0
;
	.macro	d_start	name,base
struct_index	=	base
name	equ	struct_index
	.endm
;
	.macro	struct	name
struct_index	=	0
name	equ	struct_index
	.endm
;
	.macro	d_b	name
name	equ	struct_index
struct_index	=	struct_index+1
	.endm
;
	.macro	d_even
	.if	struct_index&1
struct_index	=	struct_index+1
	.endif
	.endm
;
	.macro	d_w	name
	d_even
name	equ struct_index
struct_index	=	struct_index+2
	.endm
;
	.macro	d_ow	name
name	equ struct_index
struct_index	=	struct_index+2
	.endm
;
	.macro	d_l	name
	d_even
name	equ struct_index
struct_index	=	struct_index+4
	.endm
;
	.macro	d_ol	name
name	equ struct_index
struct_index	=	struct_index+4
	.endm
;
	.macro	d_s	name,len
name	equ struct_index
struct_index	=	struct_index+len
	.endm
;
	.macro	d_field	name,len
name	equ struct_index
struct_index	=	struct_index+(len+7)/8
field_index	=	len
	.endm
;
	.macro	d_bits	name,len
field_index	=	field_index-len
name		equ	field_index
mask_&name	equ	(1<<len)-1
amask_&name	equ	mask_&name<<field_index
	.if	(field_index < 0)
	.error	"bad bit field definition: name,len"
	.endif
	.endm
;
	.macro	d_alias	name
name	equ	struct_index
	.endm
;
	.macro	d_end	name
sizeof_&name	equ	struct_index
	.endm
;
;----------------------------------------------------------------------------
;	Macros for various data types
;
	.macro	uint8	name
	d_b	name
	.endm
;
	.macro	int8	name
	d_b	name
	.endm
;
	.macro	uint16	name
	d_w	name
	.endm
;
	.macro	int16	name
	d_w	name
	.endm
;
	.macro	uint32	name
	d_l	name
	.endm
;
	.macro	int32	name
	d_l	name
	.endm
;
	.macro	uint8_p	name
	d_l	name
	.endm
;
	.macro	int8_p	name
	d_l	name
	.endm
;
	.macro	uint16_p	name
	d_l	name
	.endm
;
	.macro	int16_p	name
	d_l	name
	.endm
;
	.macro	uint32_p	name
	d_l	name
	.endm
;
	.macro	int32_p	name
	d_l	name
	.endm
;
	.macro	char	name
	d_b	name
	.endm
;
	.macro	long	name
	d_l	name
	.endm
;
	.macro	word	name
	d_w	name
	.endm
;
	.macro	byte	name
	d_l	name
	.endm
;
	.macro	void_p	name
	d_l	name
	.endm
;
	.macro	char_p	name
	d_l	name
	.endm
;
	.macro	long_p	name
	d_l	name
	.endm
;
	.macro	func_p	name
	d_l	name
	.endm
;
	.macro	struct_p	name
	d_l	name
	.endm
;
	.macro	struc_p	name
	d_l	name
	.endm
;
;----------------------------------------------------------------------------
; End of file:	STRUCT.SH
;----------------------------------------------------------------------------
